package service;

import dao.LibraryDao;
import domin.Library;
import util.Condition;
import util.JdbcHelper;
import util.Pagination;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;

public class LibraryService {
    private static LibraryDao libraryDao= LibraryDao.getInstance();
    private static  LibraryService libraryService=new  LibraryService();
    public static  LibraryService getInstance(){

        return libraryService;
    }
    public Collection<Library> findAll(Collection<Condition> condition, Pagination pagination) throws SQLException {
        Connection connection = JdbcHelper.getConn();
        Collection<Library> libraries = libraryDao.findAll(connection,condition,pagination);
        JdbcHelper.close(connection);
        return libraries;
    }
}
